public class LambdaExample {
    public static void main(String[] args){
        Calculator adder = (a,b) -> a + b;
        Calculator subtractor = (a,b) -> a - b;
        Calculator multiplier = (a,b) -> a * b;
        Calculator divider = (a,b) -> a / b;
//        Calculator adder = new Calculator() {
//            @Override
//            public int calculate(int a, int b) {
//                return a + b;
//            }
//        };

        int resultAdd = adder.calculate(5,3);
        System.out.println("使用Lambda表达式实现的加法结果："+resultAdd);
        int resultSub = subtractor.calculate(5,3);
        System.out.println("使用Lambda表达式实现的减法结果："+resultSub);
        int resultMul = multiplier.calculate(5,3);
        System.out.println("使用Lambda表达式实现的乘法结果："+resultMul);
        int resultDiv = divider.calculate(5,3);
        System.out.println("使用Lambda表达式实现的除法结果："+resultDiv);
    }
}
